import { fetch, Headers } from 'cross-fetch';
import { json } from '../root/api';
import { XinyuanState, IState } from './atom';

const api = "/api/user"
export const postXinyuan = (data: XinyuanState) => {
  return fetch(`${api}/user/xinyuan`, {
    method: 'post',
    headers: new Headers(json),
    body: JSON.stringify(data)
  }).then(res => res.json())
}

export const postUserSign = (data: IState) => {
  return fetch(`${api}/user/sign`, {
    method: 'post',
    headers: new Headers(json),
    body: JSON.stringify(data)
  })
}

export const postOrgSign = (data: IState) => {
  return fetch(`${api}/org/sign`, {
    method: 'post',
    headers: new Headers(json),
    body: JSON.stringify(data)
  })
}